// index.js
const app = getApp()// 获取应用实例
import {ajaxFun} from "../../utils/ajax"
Page({
  data: {
     indexData:{},//首页数据
     jpobj:[],//
     hotobj:[]
  },
  onLoad(){
     this.getIndex();
     this.getJp(1);
     this.getJp(2);
  
  },

 async getIndex(){
   let result=await ajaxFun("/index","get");
   console.log(result);
    this.setData({
       indexData:result.data
    })
  },
  async getJp(type){
     let result=await ajaxFun(`/index/product/${type}`,"get",{
      page:1,
      limit:6
     });
     if(type==1){
        this.setData({
           jpobj:result.data.list
        })
     }else if(type==2){
      this.setData({
        hotobj:result.data.list
     })
     }
  },
  goodsDetailFun(e){//单机轮播图跳转页面****
      console.log(e.target.dataset.id);
  }
 
})
